#include <stdio.h>
int main ()
{
	
	int n,i;
	double max=0;
	scanf("%d",&n);
	
	struct StudentType
	{
		char sno[5];
		int grade[3];
		double mean;
	}stu[n];
	
	for(i=0;i<n;i++)
	{
		scanf("%s",stu[i].sno);
	    scanf("%d",&stu[i].grade[1]);
	    scanf("%d",&stu[i].grade[2]);
	    scanf("%d",&stu[i].grade[3]);
	    stu[i].mean=(stu[i].grade[1]+stu[i].grade[2]+stu[i].grade[3])/3.0;
	}
	for(i=0;i<n;i++)
	    printf("%.2lf\n",stu[i].mean+0.005);
	for(i=0;i<n;i++)
		max=stu[i].mean>max?stu[i].mean:max;	
	for(i=0;i<n;i++)
	{
		if(stu[i].mean=max)
			printf("%s %.2lf\n",stu[i].sno,stu[i].mean+0.005);
		else
		    continue;
	}
 } 
